import pymysql

def save_job(job_list):
    #连接数据库
    db = pymysql.connect(host='127.0.0.1',user='root',password='123456',port=3306,db='test1',charset='utf8')

    #游标对象
    cursor = db.cursor()
    #遍历数据 插入数据库
    for job in job_list:
        sql = 'insert into job(name,address,type,num) values("%s","%s","%s","%s")' % (job['name'],job['address'],job['type'],job['num'])
        cursor.execute(sql)
        db.commit()

    cursor.close()
    db.close()

